package com.ydd.controller.admin;

import com.ydd.dto.PageDTO;
import com.ydd.dto.RoleDTO;
import com.ydd.result.Result;
import com.ydd.service.impl.SysRoleServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys_role")
@Api(tags = "角色管理")
public class SysRoleController {
    @Autowired
    private SysRoleServiceImpl roleService;

    @GetMapping("/list")
    public Result roleList(PageDTO dto) {

        return roleService.roleList(dto);

    }

    @PostMapping("/update")
    public Result updateRole(@RequestBody RoleDTO dto) {
        return roleService.updateRole(dto);
    }

    @GetMapping("/rowInfo")
    public Result rowInfo(String id) {
        return roleService.rowInfo(id);
    }

    @GetMapping("/allData")
    public Result allData() {
        return roleService.allData();
    }

    @PostMapping("/add")
    public Result addRole(@RequestBody RoleDTO dto) {
        return roleService.addRole(dto);
    }

    @GetMapping("/del")
    public Result delRole(String id) {
        return roleService.delRole(id);
    }
}
